%Take the coefficients of variables that don't have, for construction, any divisor.
%
%Take the coefficients of variables that don't have, for construction, any
%divisor.
%
%Prototype: [coefficient] = getCoefficientFromString(chr)
%
%Input:     chr - String vector of an equation
%
%Output:    coefficient - Wanted coefficient

function [ coefficient ] = getCoefficientFromString( chr )

chr = strrep(chr, ' ', '');
chr = strrep(chr, '+', ' +');
chr = strrep(chr, '-', ' -');
pieces = strsplit(' ', chr);
if cellfun(@isempty, pieces(1))
    pieces(1) = [];
end

i = 1;
coefficient = 0;
warning off
while i <= length(pieces)
    if cellfun(@isempty,strfind(pieces(i),'/'))==true
        coefficient = strcat(coefficient,char(pieces(i)));
    end
    i = i + 1;
end

warning on

return;

end
